<template>
    <span v-if="caption">{{ caption }}</span>
</template>

<script>

export default {
    name: 'TnxelEnumItem',
    props: {
        type: {
            type: String,
            required: true,
        },
        subType: String,
        value: String,
        app: {
            type: String,
            default: () => window.tnx.componentDefaultApp,
        },
    },
    data() {
        return {
            caption: null,
        };
    },
    mounted() {
        window.tnx.app.rpc.resolveEnumCaption(this.type, this.subType, this.value, caption => {
            this.caption = caption;
        }, {
            app: this.app,
        });
    },
}
</script>
